home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-07 | 7.2 KB | 177 lines | [TEXT/dosa] |
- QuickDraw 3D Metafile Read/Write API routines
-
- ################################################################################
- # What are the MF3D Routines?
- ################################################################################
-
- The MF3D routines are a set of ANSI C source code files which allow developers
- who are not running QuickDraw 3D to read and to write QuickDraw 3D metafiles.
- The interface to the MF3D routines has been designed to be simple, however, it
- is assumed that anyone using these routines has a thorough understanding of
- the QuickDraw 3D metafile format. Such an understanding is especially important
- when writing files because these routines will not check, for example, that
- vertex attribute sets do not appear outside containers or that labels only
- appear on referenceable objects.
-
- ################################################################################
- # Using the MF3D Routines
- ################################################################################
-
- First, make sure that the types in "MF3DSysTypes.h" are defined as appropriate
- for your platform and system. If you alter the definition of the 64-bit integer
- types, then make sure that the macros in "MF3DInt64.h" are correct.
-
- To read QuickDraw 3D metafiles:
- 1. Call MF3DOpenInputStdCFile to open the file. MF3DOpenInputStdCFile requires
- a standard C path name and returns an MF3D_FilePtr which you will use to
- call the other MF3D routines. MF3DOpenInputStdCFile determines what kind of
- file is being read, loads any tables of contents, and does some basic
- sanity checks on the format.
- 2. Call MF3DReadAnObject to read an object. The object will be returned as
- type MF3DVoidObjPtr. You must then check object->objectType to find out
- what type of object you have and cast the pointer as appropriate. All the
- types and structures are defined in "MF3DObjects.h" and "MF3DSubObjects.h".
- When you are finished with the object, call MF3DDisposeObject.
- 3. Repeat Step 2 until kMF3DNoMoreObjects is returned.
- 4. Call MF3DClose to clean up any internal data and to close the file.
-
- To write QuickDraw 3D metafiles:
- 1. Call MF3DOpenOutputStdCFile to open the file.
- 2. Call MF3DWriteAnObject to write an object. The object you pass should be
- one of the objects defined in "MF3DObjects.h" and "MF3DSubObjects.h".
- 3. Repeat Step 2 until you have no more objects to write.
- 4. Call MF3DClose to write the Table of Contents and to close the file.
-
- ################################################################################
- # EndContainer object
- ################################################################################
-
- Because the MF3D routines only work on an object at a time, an EndContainer
- object is used to mark the end of Container. The EndContainer object is not part
- of the QuickDraw 3D metafile specification, but should nevertheless be treated
- just like any other object when using the MF3D routines.
-
- ################################################################################
- # Sample Code
- ################################################################################
-
- main.c
- Sample application that asks for a file (text or binary), reads objects
- from that file, and writes them back out into a new text file.
- MPWMain.c
- Sample MPW tool that accepts a parameter as the filename, reads objects
- from that file, and writes them back out into a new binary file.
- MPWRefExample.c
- Sample MPW tool that shows how to resolve internal and external references
- which are read from a metafile.
- MPWTest.make
- MPW Makefile that will build a tool using MPWMain.c
- MWPPC.Ê
- Metrowerks C++ project that will build an application using main.c
-
- ################################################################################
- # File Descriptions
- ################################################################################
-
- #
- # External header files
- # Anyone using the MF3D source code will be interested in these files
- #
- MF3D.h
- External interface to the MF3D routines. Most applications should not need
- to access any other routines.
- MF3DErrors.h
- Various error codes returned by the MF3D routines.
- MF3DInt64.h
- Macros needed to support usage of 64-bit integers. These need to be
- updated if the definition of MF3DInt64 is changed in "MF3DTypes.h".
- MF3DObjects.h
- Structural definition of the main (top-level) QuickDraw 3D Metafile
- objects that can be returned.
- MF3DSubObjects.h
- Structural definition of the other QuickDraw 3D Metafile objects that
- can be returned. These objects are generally found inside a container.
- MF3DSysTypes.h
- Basic system-dependent typedefs. These must be defined as appropriate
- to the platform being used.
- MF3DTypes.h
- Basic MF3D types.
-
- #
- # External implementation file
- #
- MF3D.c
- Implementation of MF3D external interface.
-
- #
- # I/O routines
- # Most developers will be able to use MF3DOpenInputStdCFile and
- # MF3DOpenOutputStdCFile. Those who want to define their own I/O routines
- # can use "MF3DStdCHooks.c" as an example.
- #
- MF3DIOCallback.h
- Structure needed when calling MF3DOpenInput or MF3DOpenOutput directly.
- MF3DStdCHooks.c
- MF3DStdCHooks.h
- Implementation to support MF3DOpenInputStdCFile and MF3DOpenOutputStdCFile.
-
- #
- # Internal files
- # These files will only be of interest to those who have a desire to
- # modify the inner workings of the MF3D routines. Each internal file contains
- # an underscore in its name. Also, the routines and types defined in these
- # files also have underscores in their names.
- #
- MF3D_Assert.h
- Set DEBUG to 1 if asserts are desired.
- MF3D_BinaryRead.c
- MF3D_BinaryRead.h
- Miscellaneous functions to handle reading binary files.
- MF3D_File.c
- MF3D_File.h
- Miscellaneous functions that mostly handle cleanup during close.
- MF3D_Groups.c
- MF3D_Groups.h
- Functions that are available that could keep track of data when pushing
- and popping groups. In Release 1.0 of MF3D, these functions essentially
- do nothing.
- MF3D_IntObjects.h
- Internal structures, including the MF3D_FilePtr.
- MF3D_Labels.c
- MF3D_Labels.h
- Enum and Flags tables and lookup routines.
- MF3D_Macros.h
- A couple of common macros.
- MF3D_Memory.c
- MF3D_Memory.h
- Memory allocation routines. These could be replaced by those who
- want to call platform-specific routines instead of the standard C library
- routines.
- MF3D_Objects.c
- MF3D_Objects.h
- All the functions which handle reading, writing, and disposing of the
- various QuickDraw 3D Metafile objects.
- MF3D_ObjectType.c
- Functions to convert between ASCII names and Binary types.
- MF3D_ObjectType.h
- Tables linking ASCII names, Binary types, and read/write/dispose functions
- of the various QuickDraw 3D Metafile objects.
- MF3D_Primitives.c
- MF3D_Primitives.h
- Lower-level functions that handle reading and writing of basic types
- (Text/Binary-independent).
- MF3D_Resolution.c
- MF3D_Resolution.h
- Functions that keep track of things when resolving references.
- MF3D_TextRead.c
- MF3D_TextRead.h
- Miscellaneous functions to handle reading text files.
- MF3D_TextStrings.h
- Equates for various QuickDraw 3D Metafile characters.
- MF3D_TextUtils.c
- MF3D_TextUtils.h
- Miscellaneous string utility functions.
- MF3D_TextWrite.c
- MF3D_TextWrite.h
- Miscellaneous functions to handle writing text files.
-